package com.yuw.bean;

import java.util.List;

public class BlogBean {
    private Integer id;

    private String title;

    private Integer authorId;

    // 一对一的映射关系
    // 配置blog 和 author之间是一对一的映射关系
    // 声明一个一端 Author的实例变量
    private AuthorBean authorBean; // 和 mapper中的 association 的property属性值保持一致

    // 一对多的映射关系
    // 配置blog和 post之间的一对多的映射关系
    // 需要使用声明要给集合来存储多端的多条查询结果集
    private List<PostBean> posts;

    public Integer getId() {
        return id;
    }

    public void setId(Integer id) {
        this.id = id;
    }

    public String getTitle() {
        return title;
    }

    public void setTitle(String title) {
        this.title = title == null ? null : title.trim();
    }

    public Integer getAuthorId() {
        return authorId;
    }

    public void setAuthorId(Integer authorId) {
        this.authorId = authorId;
    }

    public AuthorBean getAuthorBean() {
        return authorBean;
    }

    public void setAuthorBean(AuthorBean authorBean) {
        this.authorBean = authorBean;
    }

    public List<PostBean> getPosts() {
        return posts;
    }

    public void setPosts(List<PostBean> posts) {
        this.posts = posts;
    }

    @Override
    public String toString() {
        return "BlogBean{" +
                "id=" + id +
                ", title='" + title + '\'' +
                ", authorId=" + authorId +
                ", authorBean=" + authorBean +
                ", posts=" + posts +
                '}';
    }
}